package ejemplosAR;

import processing.core.PApplet;
import processing.video.*;
import jp.nyatla.nyar4psg.*;

public class MultiMarkerMio extends PApplet {

	private static final long serialVersionUID = 1L;
	private static final String PARA = "/Users/marthagarzon/Desktop/Juan Manuel/Workspace/ModuloSimulacion/data/camera_para.dat";
	private static final String HIRO = "/Users/marthagarzon/Desktop/Juan Manuel/Workspace/ModuloSimulacion/data/patt.hiro";
	private static final String KANJI ="/Users/marthagarzon/Desktop/Juan Manuel/Workspace/ModuloSimulacion/data/patt.kanji";

	private Capture cam;
	private MultiMarker nya;

	public void setup() {
		size(640,480,P3D);
		colorMode(RGB, 100);
		println(MultiMarker.VERSION);  
		cam=new Capture(this,640,480);
		nya=new MultiMarker(this,width,height,PARA,NyAR4PsgConfig.CONFIG_PSG);
		nya.addARMarker(HIRO,80);//id=0
		nya.addARMarker(KANJI,80);//id=1
	}

	public void draw()
	{
		if (cam.available())
		{
			cam.read();
			nya.detect(cam);
			background(0);
			nya.drawBackground(cam);
			for(int i=0;i<2;i++)
			{
				if(nya.isExistMarker(i))
				{
					nya.beginTransform(i);
					fill(0,100*(i%2),100*((i+1)%2));
					translate(0,0,20);
					box(40);
					nya.endTransform();
				}
			}
		}
	}
	
}